package com.mayuran19.portal.accounting.database.domain;

import java.math.BigDecimal;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import com.mayuran19.portal.common.database.domain.DomainObject;
import com.mayuran19.portal.common.database.domain.Product;
import com.mayuran19.portal.common.database.domain.Tax;
import com.mayuran19.portal.common.database.domain.UnitOfMeasure;

@Entity(name = "expense_detail")
public class ExpenseDetail extends DomainObject {
	private Long id;
	private ExpenseHeader expenseHeader;
	private Product product;
	private AccountCatagory accountCatagory;
	private String description;
	private BigDecimal quantity = new BigDecimal(0);;
	private BigDecimal unitPrice = new BigDecimal(0);;
	private BigDecimal total = new BigDecimal(0);;
	private UnitOfMeasure unitOfMeasure;
	private Tax tax;
	private BigDecimal taxTotal = new BigDecimal(0);;
	private BigDecimal netTotal = new BigDecimal(0);;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "expense_header_id")
	public ExpenseHeader getExpenseHeader() {
		return expenseHeader;
	}

	public void setExpenseHeader(ExpenseHeader expenseHeader) {
		this.expenseHeader = expenseHeader;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "product_id")
	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "account_catagory_id")
	public AccountCatagory getAccountCatagory() {
		return accountCatagory;
	}

	public void setAccountCatagory(AccountCatagory accountCatagory) {
		this.accountCatagory = accountCatagory;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public BigDecimal getQuantity() {
		return quantity;
	}

	public void setQuantity(BigDecimal quantity) {
		this.quantity = quantity;
	}

	public BigDecimal getUnitPrice() {
		return unitPrice;
	}

	public void setUnitPrice(BigDecimal unitPrice) {
		this.unitPrice = unitPrice;
	}

	public BigDecimal getTotal() {
		return total;
	}

	public void setTotal(BigDecimal total) {
		this.total = total;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "unit_of_measure_id")
	public UnitOfMeasure getUnitOfMeasure() {
		return unitOfMeasure;
	}

	public void setUnitOfMeasure(UnitOfMeasure unitOfMeasure) {
		this.unitOfMeasure = unitOfMeasure;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "tax_id")
	public Tax getTax() {
		return tax;
	}

	public void setTax(Tax tax) {
		this.tax = tax;
	}

	public BigDecimal getTaxTotal() {
		return taxTotal;
	}

	public void setTaxTotal(BigDecimal taxTotal) {
		this.taxTotal = taxTotal;
	}

	public BigDecimal getNetTotal() {
		return netTotal;
	}

	public void setNetTotal(BigDecimal netTotal) {
		this.netTotal = netTotal;
	}

}
